package com.weijianhuawen.wjblog.web.convert;

import com.weijianhuawen.wjblog.common.domain.dos.CommentDo;
import com.weijianhuawen.wjblog.web.mode.vo.comment.FindCommentItemRspVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description:
 * @date: 2024-12-09 21:03
 */

@Mapper
public interface CommentConvert {
    // 初始化convert实例
    CommentConvert INSTANCE = Mappers.getMapper(CommentConvert.class);

    // 将do转换为vo
    @Mappings({
            @Mapping(target = "userId", expression = "java(String.valueOf(bean.getUserId()))"),
            @Mapping(target = "id", expression = "java(String.valueOf(bean.getId()))"),
    })
    FindCommentItemRspVo convertCommentDo2ItemVo(CommentDo bean);
}
